package com.baidu.foodrecipe.ui.adapters

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.baidu.foodrecipe.ui.fragment.favorite.FavoriteFragment
import com.baidu.foodrecipe.ui.fragment.joke.JokeFragment
import com.baidu.foodrecipe.ui.fragment.recipes.HomeFragment
import com.baidu.foodrecipe.ui.fragment.recipes.RecipesFragment

class MainAdapter(fragmentActivity: FragmentActivity): FragmentStateAdapter(fragmentActivity) {
    override fun createFragment(position: Int): Fragment {
        return when(position){
            0 -> HomeFragment()
            1 -> FavoriteFragment()
            else  -> JokeFragment()
        }
    }

    override fun getItemCount(): Int {
        return 3
    }
}